import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/api/login',
    method: 'post',
    data
  })
}

export function getInfo() {
  return request({
    url: '/api/userinfo',
    method: 'get',
    // params: { token }
  })
}

export function logout() {
  return request({
    url: '/api/logout',
    method: 'post'
  })
}

export function register(data) {
  return request({
    url: '/api/users',
    method: 'post',
    data
  })
}

export function usernamevalidate(data) {
  return request({
    url: '/api/validate?username='+data,
    method: 'get',
  })
}

export function emailvalidate(data) {
  return request({
    url: '/api/validate?email='+data,
    method: 'get',
  })
}


export function sendcode(data) {
  return request({
    url: '/api/sendcode?email='+data,
    method: 'get',
  })
}
